﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ListMember.ascx.cs" Inherits="Member_Control_ListMember" %>
<%@ Import Namespace="MP.Core.Authentication.Entity" %>
<%@ Import Namespace="MP.Core.Config" %>
<%@ Register TagPrefix="avg" Namespace="Avg.Controls" Assembly="SmartPager" %>

<script src="/Member/js/member.js" type="text/javascript"></script>

<style type="text/css">
    li.role
    {
        background: url(/images/button/modules.png) no-repeat;
        padding-left: 22px;
        padding-top: 4px !important;
    }
</style>
<h2>
    Danh sách thành viên</h2>
<div class="func">
    <ul>
        <li class="refresh"><a href="/Member/ListMember.aspx">Đọc dữ liệu</a></li>
        <li class="search"><span box="search">Tìm kiếm</span></li>
        <li class="role"><span box="addrole" table="grid">Thêm quyền</span></li>
    </ul>
    <div style="clear: both">
    </div>
</div>
<div class="search">
    <table width="100%">
        <tr>
            <td width="120px">
                <b>Chi nhánh</b>
            </td>
            <td>
                <asp:DropDownList ID="ddlBranch" runat="server" AppendDataBoundItems="true" Width="250px">
                    <asp:ListItem Value="">Chọn chi nhánh</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <b>Phòng ban</b>
            </td>
            <td>
                <asp:DropDownList ID="ddlDepart" runat="server" AppendDataBoundItems="true" Width="250px">
                    <asp:ListItem Value="">Chọn phòng ban</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                <b>User</b>
            </td>
            <td>
                <asp:TextBox ID="txtUser" runat="server" Width="300px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <b>Danh số</b>
            </td>
            <td>
                <asp:TextBox ID="txtAgentNumber" runat="server" Width="300px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <b></b>
            </td>
            <td>
                <span class="button">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm" OnClick="btnSearch_Click" />
                    <span></span></span>
            </td>
        </tr>
    </table>
</div>
<div class="addrole">
    <div>
        <asp:HiddenField ID="hidaddrole" runat="server" />
        <asp:CheckBoxList ID="chklstRoles" runat="server" RepeatColumns="3" Width="100%"
            CssClass="chk">
        </asp:CheckBoxList>
        <span class="button">
            <asp:Button ID="btnAddRole" runat="server" Text="Thêm" OnClick="btnAddRole_Click" />
            <span></span></span><span class="button">
                <asp:Button ID="btnCancelRole" runat="server" Text="Quay ra" ValidationGroup="cancel"
                    OnClick="btnCancelRole_Click" />
                <span></span></span>
    </div>
</div>
<table width="100%" class="grid alter">
    <tr>
        <th width="30px">
            <input type="checkbox">
        </th>
        <th width="35px">
        </th>
        <th width="45">
        </th>
        <th width="45">
        </th>
        <th>
            Tên đăng nhập
        </th>
        <th width="80px">
            Chi nhánh
        </th>
        <th width="80px">
            Phòng ban
        </th>
        <th width="120px">
            Chức vụ
        </th>
        <th width="40px">
        </th>
        <th width="40px">
        </th>
        <th width="40px">
        </th>
        <th width="40px">
        </th>
        <th width="40px">
        </th>
        <th width="40px">
        </th>
    </tr>
    <asp:Repeater ID="repMember" runat="server" OnItemCommand="repMember_ItemCommand">
        <ItemTemplate>
            <tr>
                <td align="center">
                    <div id="Div1" runat="server" visible='<%# IsEditForce(Eval("UserName").ToString()) %>'>
                        <input type="checkbox" id='<%# Eval("UserName") %>'>
                    </div>
                </td>
                <td align="center">
                    <%# Container.ItemIndex + 1 + pageindex() %>
                    <asp:HiddenField ID="HidID" runat="server" Value='<%# Eval("UserName") %>' />
                </td>
                <td align="center">
                    <%# Eval("AgentNumber")%>
                </td>
                <td align="center">
                <%# Eval("MachineId") %>
                </td>
                <td>
                    <div class="click viewPopup member" rel='member,<%# Eval("UserName") %>'>
                        <% if (IsAction(EnumActions.EDIT))
                           { %>
                        <a href='/Member/Profile.aspx?user=<%# Eval("UserName") %>'>
                            <%# Eval("UserName") %>
                        </a>
                        <%}
                           else
                           { %>
                        <%# Eval("UserName") %>
                        <%} %>
                    </div>
                </td>
                <td>
                    <%# Eval("BranhCode") %>
                </td>
                <td>
                    <%# Eval("DepartCode") %>
                </td>
                <td>
                    <%# Eval("JobName") %>
                </td>
                <td align="center">
                    <div runat="server" visible='<%# IsEditForce(Eval("UserName").ToString()) %>'>
                        <a href='/Member/Permission.aspx?u=<%# Eval("UserName") %>' title="Phân quyền">
                            <img src="/images/button/modules.png" />
                        </a>
                    </div>
                    <div runat="server" visible='<%# !IsEditForce(Eval("UserName").ToString()) %>'>
                        <img src="/images/button/modules2.png" />
                    </div>
                </td>
                <td align="center">
                    <div runat="server" visible='<%# IsEditForce(Eval("UserName").ToString()) %>'>
                        <div class='click reset-password u-<%# Eval("UserName") %>' id='<%# Eval("UserName") %>'>
                            <img src="/images/button/password.png" title="Reset mật khẩu" alt="Reset mật khẩu" />
                        </div>
                        <div class='u-<%# Eval("UserName") %>' style="display: none">
                            <img src="/images/processing.gif" />
                        </div>
                    </div>
                    <div runat="server" visible='<%# !IsEditForce(Eval("UserName").ToString()) %>'>
                        <img src="/images/button/password2.png" />
                    </div>
                </td>
                <%--<td align="center">
                        <img src='/images/button/<%# getImageOnline(Convert.ToBoolean(Eval("IsOnline"))) %>' />
                </td>--%>
                <td align="center">
                    <div runat="server" visible='<%# IsEnableForce(Eval("UserName").ToString()) %>'>
                        <asp:LinkButton ID="enable" runat="server" CommandName="enable" CommandArgument='<%# Eval("UserName") %>'
                            ValidationGroup="member" ToolTip="Bật/tắt user">
                        <img src='/images/button/<%# getImageActive(Convert.ToBoolean(Eval("IsApproved"))) %>.png' />
                        </asp:LinkButton>
                    </div>
                    <div runat="server" visible='<%# !IsEnableForce(Eval("UserName").ToString()) %>'>
                        <img src='/images/button/<%# getImageActive(Convert.ToBoolean(Eval("IsApproved"))) %>2.png'
                            title="Bật/tắt user" alt="Bật/tắt user" />
                    </div>
                </td>
                <td align="center">
                    <div id="Div2" runat="server" visible='<%# IsEnableForce(Eval("UserName").ToString()) %>'>
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="lock" CommandArgument='<%# Eval("UserName") %>'
                            ValidationGroup="member" ToolTip="Unlock user">
                        <img src='/images/button/<%# getImageLock(Convert.ToBoolean(Eval("IsLockedOut"))) %>.png' />
                        </asp:LinkButton>
                    </div>
                    <div id="Div3" runat="server" visible='<%# !IsEnableForce(Eval("UserName").ToString()) %>'>
                        <img src='/images/button/<%# getImageLock(Convert.ToBoolean(Eval("IsLockedOut"))) %>2.png'
                            title="Bật/tắt user" alt="Unlock user" />
                    </div>
                </td>
                <td align="center">
                    <div runat="server" visible='<%# IsEditForce(Eval("UserName").ToString()) %>'>
                        <a href='/Member/Profile.aspx?user=<%# Eval("UserName") %>' title="Cập nhật thông tin cá nhân">
                            <img src="/images/button/edit.png" />
                        </a>
                    </div>
                    <div runat="server" visible='<%# !IsEditForce(Eval("UserName").ToString()) %>'>
                        <img src="/images/button/edit2.png" title="Cập nhật thông tin cá nhân" alt="Cập nhật thông tin cá nhân" />
                    </div>
                </td>
                <td align="center">
                    <div runat="server" visible='<%# IsDeletedForce(Eval("UserName").ToString()) %>'>
                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="del" CommandArgument='<%# Eval("UserName") %>'
                            ValidationGroup="member" OnClientClick="return confirm('Xác nhận xóa?')" ToolTip="Xóa thành viên">
                        <img src="/images/button/remove_user.png" />
                        </asp:LinkButton>
                    </div>
                    <div runat="server" visible='<%# !IsDeletedForce(Eval("UserName").ToString()) %>'>
                        <img src="/images/button/remove_user2.png" title="Xóa thành viên" alt="Xóa thành viên" />
                    </div>
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
</table>
<avg:SmartPager ID="smartPager" runat="server" Visible="false" />
<div id="form" title="View">
    <div id="content">
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        $(".func").fmenu("grid");
    });
</script>

